extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "逍遥"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 6                 # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7                    # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 3                 # 魔法攻击（每点代表13.7）
	attCoe.def = 3                    # 物理防御（每点代表15）
	attCoe.mgiDef = 3                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dang" 
	xb = "木"
	lv = 4  
	addSkillTxt("[一剑]逍遥挥出随心一剑，造成100%木系物理伤害，有30%概率吸取目标体力值，数值=自身已损失体力值[CD:8]")
	addSkillTxt("[和光]逍遥领悟和光同尘，对目标造成140%光系物理伤害，30%概率清空目标增益[CD:12]")
	addSkillTxt("[剑指九霄]造成200%木系物理伤害，50%概率使目标<禁疗>10秒[CD:15]")
	addSkillTxt("[color=#FFFF00][逍遥无我][/color][color=#FFCC22]阵亡后使全体友军获得逍遥祝福，免疫接下来的5次致命攻击[/color]")
	addCdSkill("yj",8)
	addCdSkill("hg",12)
	addCdSkill("jx",15)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "yj":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("一剑", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		if sys.rndPer(30):
			hurtChara(aiCha,(att.maxHp-att.hp)*1,Chara.HurtType.REAL,Chara.AtkType.EFF)
			plusHp(atkInfo.hurtVal)
	if id == "hg":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("和光", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1.4,Chara.HurtType.PHY,Chara.AtkType.SKILL,"光")
		if sys.rndPer(30):
			for j in buffs:
				if j.isNegetive and j.get("dispelable") != true:
					j.isDel = true	
	if id == "jx":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("剑指九霄", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*2,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		if sys.rndPer(50):
			aiCha.addSkillTxt(bf.b_jinliao.new(10))
var cnt = 5
func _onDeath(atkInfo):
	._onDeath(atkInfo)
	var chas = getAllChas(2)
	for i in chas:
		i.addBuff(wuwo.new(1))

func _onBattleStart():
	._onBattleStart()
	cnt = 5

class wuwo:
	extends Buff
	var canremove:bool = false
	var cnt
	func _init(lv):
		attInit()
		id == "wuwo"
		self.cnt = lv
	func _connect():
		masCha.connect("onHurt",self,"run")

	func run(atkinfo):
		if cnt && !atkinfo.isMiss && atkinfo.hurtVal > masCha.att.hp:
			cnt -= 1
			atkinfo.hurtVal = 0
			if !cnt:
				isDel = true